﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UnitAreaRecent.aspx.cs"
    Inherits="Taxes.KML.UnitAreaRecent" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        var modify = function (cmd, record, rowIndex) {
            if (cmd == "Modify") {
                tfName.setValue(record.data.region_name);
                tfPrice.setValue(record.data.region_unit_price);
                tfHiddenID.setValue(record.id);
                window1.show();
            }
        }
        var render = function (value, cellmeta, record, rowIndex, columnIndex, store) {
            return value + "元/平方米";
        }
        function Cancel() {
            window1.hide();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <div>
        <ext:Window runat="server" ID="window1" Width="600" Height="200" Title="修改租金" Padding="5"
            Layout="FormLayout" Hidden="true">
            <Items>
                <ext:Hidden runat="server" ID="tfHiddenID" Text="">
                </ext:Hidden>
                <ext:TextField ID="tfName" runat="server" AnchorHorizontal="100%" AllowBlank="false"
                    ReadOnly="true" FieldLabel="区域名称">
                </ext:TextField>
                <ext:TextField ID="tfPrice" runat="server" AllowBlank="false" AnchorHorizontal="100%"
                    Regex="/^[\+\-]?\d*?\.?\d*?$/" RegexText="只能输入数字" FieldLabel="租金<font color='red'>*</font>">
                </ext:TextField>
            </Items>
            <Buttons>
                <ext:Button ID="btnSave" runat="server" Icon="Disk" Text="保存">
                    <DirectEvents>
                        <Click OnEvent="btnSave_Click">
                            <EventMask ShowMask="True" Msg="正在保存..." MinDelay="1000" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
                <ext:Button ID="btnCancel" runat="server" Icon="Cancel" Text="取消">
                    <Listeners>
                        <Click Fn="Cancel" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Window>
        <ext:GridPanel runat="server" ID="grid" AutoHeight="true" AutoWidth="true">
            <AutoLoad ShowMask="true" MaskMsg="正在加载,请稍后...">
            </AutoLoad>
            <Store>
                <ext:Store ID="store" runat="server">
                    <Reader>
                        <ext:JsonReader IDProperty="ID">
                            <Fields>
                                <ext:RecordField Name="ID" Type="Int">
                                </ext:RecordField>
                                <ext:RecordField Name="region_name" Type="String">
                                </ext:RecordField>
                                <ext:RecordField Name="region_unit_price" Type="Float">
                                </ext:RecordField>
                                <ext:RecordField Name="in_date" Type="Date">
                                </ext:RecordField>
                            </Fields>
                        </ext:JsonReader>
                    </Reader>
                </ext:Store>
            </Store>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="10" StoreID="store"
                    DisplayInfo="true">
                </ext:PagingToolbar>
            </BottomBar>
            <ColumnModel>
                <Columns>
                    <ext:Column ColumnID="colName" DataIndex="region_name" Header="区域名称">
                    </ext:Column>
                    <ext:Column ColumnID="colPrice" DataIndex="region_unit_price" Header="单位面积租金">
                        <Renderer Fn="render" />
                    </ext:Column>
                    <ext:DateColumn ColumnID="colDate" DataIndex="in_date" Header="修改日期" Format="yyyy-MM-dd">
                    </ext:DateColumn>
                    <ext:CommandColumn Header="操作">
                        <Commands>
                            <ext:GridCommand CommandName="Modify" Icon="ApplicationEdit">
                            </ext:GridCommand>
                        </Commands>
                    </ext:CommandColumn>
                </Columns>
            </ColumnModel>
            <Listeners>
                <Command Fn="modify" />
            </Listeners>
            <Buttons>
                <ext:Button ID="btnImport" runat="server" Text="导入区域">
                    <Listeners>
                        <Click Handler="window.location.href = 'KMLImport.aspx';" />
                    </Listeners>
                </ext:Button>
                <ext:Button ID="btnExport" runat="server" Text="导出">
                    <DirectEvents>
                        <Click OnEvent="btnExport_Click">
                            <EventMask ShowMask="true" Msg="正在导出请稍后.." MinDelay="500" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>
        </ext:GridPanel>
    </div>
    </form>
</body>
</html>
